package com.java.gulimall.member.web;

import com.java.common.utils.R;
import com.java.gulimall.member.feign.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

/**
 * @author jl
 * Created on 2020/9/21
 */
@Controller
public class MemberWebCotroller {
    @Autowired
    private OrderFeignService orderFeignService;

    /**
     * 这个请求是从浏览器发过来的,会带上cookie,配置feign请求拦截器设置request
     */
    @GetMapping("/memberOrder.html")
    public String memberOrderPage(@RequestParam(value = "page",defaultValue = "1") Integer page, Model model) {
        Map<String, Object> map = new HashMap<>();
        map.put("page",page.toString());
        R r = orderFeignService.listWithItem(map);
        model.addAttribute("orders",r);
        return "orderList";
    }
}
